from pyspark import SparkContext
from pyspark import SparkConf

conf = SparkConf().setAppName("python").setMaster("local")
sc = SparkContext(conf=conf)

sc \
    .textFile(name="data/students.txt") \
    .map(lambda line: (line.split(",")[4], 1)) \
    .reduceByKey(lambda x, y: x + y) \
    .saveAsTextFile("data/count")
